import request from "@/util/request";

export function addResidential(data){
    return request({
        url: '/residential/add',
        method: 'post',
        data: data
    })
}

export function deletedResidential(id){
    return request({
        url: '/residential/delete/' + id,
        method: 'delete'
    })
}

export function pageResidential(pageNum, pageSize){
    return request({
        url: '/residential/page?pageNum=' + pageNum + '&pageSize=' + pageSize,
        method: 'get'
    })
}

export function getResidentialHeader(){
    return request({
        url: '/residential/list_header',
        method: 'get'
    })
}

export function exportExcelResidential(){
    return request({
        responseType: 'blob',
        url: '/residential/excel_download',
        method: 'post'
    })
}

export function searchResidential(searchObj, pageNum, pageSize){
    return request({
        url: '/residential/search',
        method: 'post',
        params: { pageNum, pageSize },
        data: searchObj
    })
}

export function updateResidential(data){
    return request({
        url: '/residential/update',
        method: 'post',
        data: data
    })
}

/**
 * 验证表单对象是否为空
 * @param obj
 */
export function validObj(obj) {
    return JSON.stringify(obj) !== '{}'
}
